package xiao.ke.sbdemo.controller;/**
 * @author XuXiaoK
 * @create 2019-11-26 12:57
 */

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xiao.ke.sbdemo.model.MyException;
import xiao.ke.sbdemo.model.User;

import java.util.Date;

/**
 *@Author XiaoKe
 *@Date 2019/11/26 12:57
 *@Description 用于测试自定义全局异常的controller
 */
@RestController
public class ExcptionController {

    @RequestMapping("api/xiaoke")
    public Object index() {
        int i = 1/0;

        return new User(11,"ddd", "444", new Date());
    }

    @RequestMapping("/api/xiaoke2")
    public Object myexc(){

        throw new MyException("499", "my ext异常");

    }
}
